* Replication materials for Going Public in an Era of Social Media: Tweets, Corrections, and Public Opinion *

* CODE FOR FIGURE 2 *
use "D:\Dropbox\Trump twitter paper\ckk_PSQ_2020_replication.dta" 

gen n = _n
gen diff = .
gen l = .
gen u = .
gen sediff = .
gen treatment = .
gen group = .

ttest mail_fraud_bin if control==1|tweet==1, by(tweet)
replace diff = r(mu_2)-r(mu_1) if n == 1
replace sediff = r(se) if n == 1
replace treatment = 1 if n == 1

ttest mail_fraud_bin if control==1|flag==1, by(flag)
replace diff = r(mu_2)-r(mu_1) if n == 2
replace sediff = r(se) if n == 2
replace treatment = 2 if n == 2

ttest mail_fraud_bin if control==1|correction==1, by(correction)
replace diff = r(mu_2)-r(mu_1) if n == 3
replace sediff = r(se) if n == 3
replace treatment = 3 if n == 3

ttest mail_fraud_bin if control==1|enhanced==1, by(enhanced)
replace diff = r(mu_2)-r(mu_1) if n == 4
replace sediff = r(se) if n == 4
replace treatment = 4 if n == 4

label define cats 1 "Tweet" 2 "Flag" 3 "Correction" 4 "Enhanced"
label values treatment cats

replace l = diff-1.96*(sediff)
replace u = diff+1.96*(sediff)

gen x = _n
recode x  (4=1) (3=2) (2=3) (1=4)
replace x = . if x>4

twoway (dot  diff x, horizontal ndots(0) dcolor(white) symbol(circle) color(black)) ///
(rcap u l x, horizontal color(black)), yti("") graphregion(color(white)) ///
xlabel(-.2 "-20%" -.1 "-10%" 0 "0%" .1 "10%" .2 "20%") xline(0) ///
ylabel(1 "Enhanced" 2 "Correction" 3 "Flagged" 4 "Tweet", angle(0)) /// 
ti("Mail Fraud Occurs" " ") saving(mail.gph, replace) legend(off)

* Prevalence of Fraud *
use trump_step.dta, replace

gen n = _n
gen diff = .
gen l = .
gen u = .
gen sediff = .
gen treatment = .
gen group = .

ttest fraud if control==1|tweet==1, by(tweet)
replace diff = r(mu_2)-r(mu_1) if n == 1
replace sediff = r(se) if n == 1
replace treatment = 1 if n == 1

ttest fraud if control==1|flag==1, by(flag)
replace diff = r(mu_2)-r(mu_1) if n == 2
replace sediff = r(se) if n == 2
replace treatment = 2 if n == 2

ttest fraud if control==1|correction==1, by(correction)
replace diff = r(mu_2)-r(mu_1) if n == 3
replace sediff = r(se) if n == 3
replace treatment = 3 if n == 3

ttest fraud if control==1|enhanced==1, by(enhanced)
replace diff = r(mu_2)-r(mu_1) if n == 4
replace sediff = r(se) if n == 4
replace treatment = 4 if n == 4

label define cats 1 "Tweet" 2 "Flag" 3 "Correction" 4 "Enhanced"
label values treatment cats

replace l = diff-1.96*(sediff)
replace u = diff+1.96*(sediff)

gen x = _n
recode x  (4=1) (3=2) (2=3) (1=4)
replace x = . if x>4

twoway (dot  diff x, horizontal ndots(0) dcolor(white) symbol(circle) color(black)) ///
(rcap u l x, horizontal color(black)), yti("") graphregion(color(white)) ///
xline(0) ///
ylabel(1 "Enhanced" 2 "Correction" 3 "Flagged" 4 "Tweet", angle(0)) /// 
ti("Prevalence of Fraud" " ") saving(prevalence.gph, replace) legend(off)

* Support Mail Voting in 2020 *
use trump_step.dta, replace

gen n = _n
gen diff = .
gen l = .
gen u = .
gen sediff = .
gen treatment = .
gen group = .

ttest mail_bin if control==1|tweet==1, by(tweet)
replace diff = r(mu_2)-r(mu_1) if n == 1
replace sediff = r(se) if n == 1
replace treatment = 1 if n == 1

ttest mail_bin if control==1|flag==1, by(flag)
replace diff = r(mu_2)-r(mu_1) if n == 2
replace sediff = r(se) if n == 2
replace treatment = 2 if n == 2

ttest mail_bin if control==1|correction==1, by(correction)
replace diff = r(mu_2)-r(mu_1) if n == 3
replace sediff = r(se) if n == 3
replace treatment = 3 if n == 3

ttest mail_bin if control==1|enhanced==1, by(enhanced)
replace diff = r(mu_2)-r(mu_1) if n == 4
replace sediff = r(se) if n == 4
replace treatment = 4 if n == 4

label define cats 1 "Tweet" 2 "Flag" 3 "Correction" 4 "Enhanced"
label values treatment cats

replace l = diff-1.96*(sediff)
replace u = diff+1.96*(sediff)

gen x = _n
recode x  (4=1) (3=2) (2=3) (1=4)
replace x = . if x>4

twoway (dot  diff x, horizontal ndots(0) dcolor(white) symbol(circle) color(black)) ///
(rcap u l x, horizontal color(black)), yti("") graphregion(color(white)) ///
xlabel(-.2 "-20%" -.1 "-10%" 0 "0%" .1 "10%" .2 "20%") xline(0) ///
ylabel(1 "Enhanced" 2 "Correction" 3 "Flagged" 4 "Tweet", angle(0)) /// 
ti("Support Voting by Mail 2020" " ") saving(vote.gph, replace) legend(off)

* Support EO *
use trump_step.dta, replace

gen n = _n
gen diff = .
gen l = .
gen u = .
gen sediff = .
gen treatment = .
gen group = .

ttest support_eo_bin if control==1|tweet==1, by(tweet)
replace diff = r(mu_2)-r(mu_1) if n == 1
replace sediff = r(se) if n == 1
replace treatment = 1 if n == 1

ttest support_eo_bin if control==1|flag==1, by(flag)
replace diff = r(mu_2)-r(mu_1) if n == 2
replace sediff = r(se) if n == 2
replace treatment = 2 if n == 2

ttest support_eo_bin if control==1|correction==1, by(correction)
replace diff = r(mu_2)-r(mu_1) if n == 3
replace sediff = r(se) if n == 3
replace treatment = 3 if n == 3

ttest support_eo_bin if control==1|enhanced==1, by(enhanced)
replace diff = r(mu_2)-r(mu_1) if n == 4
replace sediff = r(se) if n == 4
replace treatment = 4 if n == 4

label define cats 1 "Tweet" 2 "Flag" 3 "Correction" 4 "Enhanced"
label values treatment cats

replace l = diff-1.96*(sediff)
replace u = diff+1.96*(sediff)

gen x = _n
recode x  (4=1) (3=2) (2=3) (1=4)
replace x = . if x>4

twoway (dot  diff x, horizontal ndots(0) dcolor(white) symbol(circle) color(black)) ///
(rcap u l x, horizontal color(black)), yti("") graphregion(color(white)) ///
xlabel(-.2 "-20%" -.1 "-10%" 0 "0%" .1 "10%" .2 "20%") xline(0) ///
ylabel(1 "Enhanced" 2 "Correction" 3 "Flagged" 4 "Tweet", angle(0)) /// 
ti("Support Executive Order" " ") saving(eo.gph, replace) legend(off)

graph combine mail.gph prevalence.gph vote.gph eo.gph, graphregion(color(white)) iscale(.5)

* CODE FOR FIGURE 3 *

* Alternate Figure 2 with change in opinion from t-tests *
* Mail Fraud Occurs *
use trump_step.dta, replace

gen n = _n
gen diff = .
gen l = .
gen u = .
gen sediff = .
gen treatment = .
gen group = .

ttest mail_fraud_bin if control==1 & dem5 == 1|tweet==1 & dem5 == 1, by(tweet)
replace diff = r(mu_2)-r(mu_1) if n == 1
replace sediff = r(se) if n == 1
replace group = 2 if n == 1
replace treatment = 1 if n == 1

ttest mail_fraud_bin if control==1 & gop5 == 1 |tweet==1 & gop5 == 1, by(tweet)
replace diff = r(mu_2)-r(mu_1) if n == 2
replace sediff = r(se) if n == 2
replace group = 1 if n == 2
replace treatment = 1 if n == 2

ttest mail_fraud_bin if control==1 & dem5 == 1|flag==1 & dem5 == 1, by(flag)
replace diff = r(mu_2)-r(mu_1) if n == 3
replace sediff = r(se) if n == 3
replace group = 2 if n == 3
replace treatment = 2 if n == 3

ttest mail_fraud_bin if control==1 & gop5 == 1 |flag==1 & gop5 == 1, by(flag)
replace diff = r(mu_2)-r(mu_1) if n == 4
replace sediff = r(se) if n == 4
replace group = 1 if n == 4
replace treatment = 2 if n == 4

ttest mail_fraud_bin if control==1 & dem5 == 1|correction==1 & dem5 == 1, by(correction)
replace diff = r(mu_2)-r(mu_1) if n == 5
replace sediff = r(se) if n == 5
replace group = 2 if n == 5
replace treatment = 3 if n == 5

ttest mail_fraud_bin if control==1 & gop5 == 1 |correction==1 & gop5 == 1, by(correction)
replace diff = r(mu_2)-r(mu_1) if n == 6
replace sediff = r(se) if n == 6
replace group = 1 if n == 6
replace treatment = 3 if n == 6

ttest mail_fraud_bin if control==1 & dem5 == 1|enhanced==1 & dem5 == 1, by(enhanced)
replace diff = r(mu_2)-r(mu_1) if n == 7
replace sediff = r(se) if n == 7
replace group = 2 if n == 7
replace treatment = 4 if n == 7

ttest mail_fraud_bin if control==1 & gop5 == 1 |enhanced==1 & gop5 == 1, by(enhanced)
replace diff = r(mu_2)-r(mu_1) if n == 8
replace sediff = r(se) if n == 8
replace group = 1 if n == 8
replace treatment = 4 if n == 8

label define cats 1 "Tweet" 2 "Flag" 3 "Correction" 4 "Enhanced"
label define groups 3 "All" 2 "Democrats" 1 "Republicans"
label values group groups
label values treatment cats

replace l = diff-1.96*(sediff)
replace u = diff+1.96*(sediff)

gen x = _n
recode x  (8=1) (7=2) (6=3) (5=4) (4=5) (3=6) (2=7) (1=8)
replace x = . if x >8
replace x = x+2 if x >=3
replace x = x+2 if x >= 7
replace x = x+2 if x >= 11

separate diff, by(group)

twoway (dot  diff1 x, horizontal ndots(0) dcolor(white) symbol(triangle) color(black)) ///
(dot  diff2 x, horizontal ndots(0) dcolor(white) symbol(square) color(black)) ///
(rcap u l x, horizontal color(black)), yti("") graphregion(color(white)) ///
xlabel(-.2 "-20%" -.1 "-10%" 0 "0%" .1 "10%" .2 "20%") xline(0) ///
ylabel(1.5 "Enhanced" 5.5 "Correction" 9.5 "Flag" 13.5 "Tweet", angle(0)) /// 
ti("Mail Fraud Occurs" " ") ///
legend(order(2 "Democrats" 1 "Republicans") size(medsmall) keygap(0) cols(3)) saving(mailparty.gph, replace)


* Prevalence of Fraud *
use trump_step.dta, replace

gen n = _n
gen diff = .
gen l = .
gen u = .
gen sediff = .
gen treatment = .
gen group = .

ttest fraud if control==1 & dem5 == 1|tweet==1 & dem5 == 1, by(tweet)
replace diff = r(mu_2)-r(mu_1) if n == 1
replace sediff = r(se) if n == 1
replace group = 2 if n == 1
replace treatment = 1 if n == 1

ttest fraud if control==1 & gop5 == 1 |tweet==1 & gop5 == 1, by(tweet)
replace diff = r(mu_2)-r(mu_1) if n == 2
replace sediff = r(se) if n == 2
replace group = 1 if n == 2
replace treatment = 1 if n == 2

ttest fraud if control==1 & dem5 == 1|flag==1 & dem5 == 1, by(flag)
replace diff = r(mu_2)-r(mu_1) if n == 3
replace sediff = r(se) if n == 3
replace group = 2 if n == 3
replace treatment = 2 if n == 3

ttest fraud if control==1 & gop5 == 1 |flag==1 & gop5 == 1, by(flag)
replace diff = r(mu_2)-r(mu_1) if n == 4
replace sediff = r(se) if n == 4
replace group = 1 if n == 4
replace treatment = 2 if n == 4

ttest fraud if control==1 & dem5 == 1|correction==1 & dem5 == 1, by(correction)
replace diff = r(mu_2)-r(mu_1) if n == 5
replace sediff = r(se) if n == 5
replace group = 2 if n == 5
replace treatment = 3 if n == 5

ttest fraud if control==1 & gop5 == 1 |correction==1 & gop5 == 1, by(correction)
replace diff = r(mu_2)-r(mu_1) if n == 6
replace sediff = r(se) if n == 6
replace group = 1 if n == 6
replace treatment = 3 if n == 6

ttest fraud if control==1 & dem5 == 1|enhanced==1 & dem5 == 1, by(enhanced)
replace diff = r(mu_2)-r(mu_1) if n == 7
replace sediff = r(se) if n == 7
replace group = 2 if n == 7
replace treatment = 4 if n == 7

ttest fraud if control==1 & gop5 == 1 |enhanced==1 & gop5 == 1, by(enhanced)
replace diff = r(mu_2)-r(mu_1) if n == 8
replace sediff = r(se) if n == 8
replace group = 1 if n == 8
replace treatment = 4 if n == 8

label define cats 1 "Tweet" 2 "Flag" 3 "Correction" 4 "Enhanced"
label define groups 3 "All" 2 "Democrats" 1 "Republicans"
label values group groups
label values treatment cats

replace l = diff-1.96*(sediff)
replace u = diff+1.96*(sediff)

gen x = _n
recode x  (8=1) (7=2) (6=3) (5=4) (4=5) (3=6) (2=7) (1=8)
replace x = . if x >8
replace x = x+2 if x >=3
replace x = x+2 if x >= 7
replace x = x+2 if x >= 11

separate diff, by(group)

twoway (dot  diff1 x, horizontal ndots(0) dcolor(white) symbol(triangle) color(black)) ///
(dot  diff2 x, horizontal ndots(0) dcolor(white) symbol(square) color(black)) ///
(rcap u l x, horizontal color(black)), yti("") graphregion(color(white)) ///
xline(0) ///
ylabel(1.5 "Enhanced" 5.5 "Correction" 9.5 "Flag" 13.5 "Tweet", angle(0)) /// 
ti("Prevalence of Fraud" " ") ///
legend(order(2 "Democrats" 1 "Republicans") size(medsmall) keygap(0) cols(3)) saving(prevalenceparty.gph, replace)
*xlabel(-.2 "-20%" -.1 "-10%" 0 "0%" .1 "10%" .2 "20%") xline(0) ///


* Mail Voting in 2020 *
use trump_step.dta, replace

gen n = _n
gen diff = .
gen l = .
gen u = .
gen sediff = .
gen treatment = .
gen group = .

ttest mail_bin if control==1 & dem5 == 1|tweet==1 & dem5 == 1, by(tweet)
replace diff = r(mu_2)-r(mu_1) if n == 1
replace sediff = r(se) if n == 1
replace group = 2 if n == 1
replace treatment = 1 if n == 1

ttest mail_bin if control==1 & gop5 == 1 |tweet==1 & gop5 == 1, by(tweet)
replace diff = r(mu_2)-r(mu_1) if n == 2
replace sediff = r(se) if n == 2
replace group = 1 if n == 2
replace treatment = 1 if n == 2

ttest mail_bin if control==1 & dem5 == 1|flag==1 & dem5 == 1, by(flag)
replace diff = r(mu_2)-r(mu_1) if n == 3
replace sediff = r(se) if n == 3
replace group = 2 if n == 3
replace treatment = 2 if n == 3

ttest mail_bin if control==1 & gop5 == 1 |flag==1 & gop5 == 1, by(flag)
replace diff = r(mu_2)-r(mu_1) if n == 4
replace sediff = r(se) if n == 4
replace group = 1 if n == 4
replace treatment = 2 if n == 4

ttest mail_bin if control==1 & dem5 == 1|correction==1 & dem5 == 1, by(correction)
replace diff = r(mu_2)-r(mu_1) if n == 5
replace sediff = r(se) if n == 5
replace group = 2 if n == 5
replace treatment = 3 if n == 5

ttest mail_bin if control==1 & gop5 == 1 |correction==1 & gop5 == 1, by(correction)
replace diff = r(mu_2)-r(mu_1) if n == 6
replace sediff = r(se) if n == 6
replace group = 1 if n == 6
replace treatment = 3 if n == 6

ttest mail_bin if control==1 & dem5 == 1|enhanced==1 & dem5 == 1, by(enhanced)
replace diff = r(mu_2)-r(mu_1) if n == 7
replace sediff = r(se) if n == 7
replace group = 2 if n == 7
replace treatment = 4 if n == 7

ttest mail_bin if control==1 & gop5 == 1 |enhanced==1 & gop5 == 1, by(enhanced)
replace diff = r(mu_2)-r(mu_1) if n == 8
replace sediff = r(se) if n == 8
replace group = 1 if n == 8
replace treatment = 4 if n == 8

label define cats 1 "Tweet" 2 "Flag" 3 "Correction" 4 "Enhanced"
label define groups 3 "All" 2 "Democrats" 1 "Republicans"
label values group groups
label values treatment cats

replace l = diff-1.96*(sediff)
replace u = diff+1.96*(sediff)

gen x = _n
recode x  (8=1) (7=2) (6=3) (5=4) (4=5) (3=6) (2=7) (1=8)
replace x = . if x >8
replace x = x+2 if x >=3
replace x = x+2 if x >= 7
replace x = x+2 if x >= 11

separate diff, by(group)

twoway (dot  diff1 x, horizontal ndots(0) dcolor(white) symbol(triangle) color(black)) ///
(dot  diff2 x, horizontal ndots(0) dcolor(white) symbol(square) color(black)) ///
(rcap u l x, horizontal color(black)), yti("") graphregion(color(white)) ///
xlabel(-.2 "-20%" -.1 "-10%" 0 "0%" .1 "10%" .2 "20%") xline(0) ///
ylabel(1.5 "Enhanced" 5.5 "Correction" 9.5 "Flag" 13.5 "Tweet", angle(0)) /// 
ti("Support Voting by Mail in 2020" " ") ///
legend(order(2 "Democrats" 1 "Republicans") size(medsmall) keygap(0) cols(3)) saving(votemail2020party.gph, replace)

* Support EO *
use trump_step.dta, replace

gen n = _n
gen diff = .
gen l = .
gen u = .
gen sediff = .
gen treatment = .
gen group = .

ttest support_eo_bin if control==1 & dem5 == 1|tweet==1 & dem5 == 1, by(tweet)
replace diff = r(mu_2)-r(mu_1) if n == 1
replace sediff = r(se) if n == 1
replace group = 2 if n == 1
replace treatment = 1 if n == 1

ttest support_eo_bin if control==1 & gop5 == 1 |tweet==1 & gop5 == 1, by(tweet)
replace diff = r(mu_2)-r(mu_1) if n == 2
replace sediff = r(se) if n == 2
replace group = 1 if n == 2
replace treatment = 1 if n == 2

ttest support_eo_bin if control==1 & dem5 == 1|flag==1 & dem5 == 1, by(flag)
replace diff = r(mu_2)-r(mu_1) if n == 3
replace sediff = r(se) if n == 3
replace group = 2 if n == 3
replace treatment = 2 if n == 3

ttest support_eo_bin if control==1 & gop5 == 1 |flag==1 & gop5 == 1, by(flag)
replace diff = r(mu_2)-r(mu_1) if n == 4
replace sediff = r(se) if n == 4
replace group = 1 if n == 4
replace treatment = 2 if n == 4

ttest support_eo_bin if control==1 & dem5 == 1|correction==1 & dem5 == 1, by(correction)
replace diff = r(mu_2)-r(mu_1) if n == 5
replace sediff = r(se) if n == 5
replace group = 2 if n == 5
replace treatment = 3 if n == 5

ttest support_eo_bin if control==1 & gop5 == 1 |correction==1 & gop5 == 1, by(correction)
replace diff = r(mu_2)-r(mu_1) if n == 6
replace sediff = r(se) if n == 6
replace group = 1 if n == 6
replace treatment = 3 if n == 6

ttest support_eo_bin if control==1 & dem5 == 1|enhanced==1 & dem5 == 1, by(enhanced)
replace diff = r(mu_2)-r(mu_1) if n == 7
replace sediff = r(se) if n == 7
replace group = 2 if n == 7
replace treatment = 4 if n == 7

ttest support_eo_bin if control==1 & gop5 == 1 |enhanced==1 & gop5 == 1, by(enhanced)
replace diff = r(mu_2)-r(mu_1) if n == 8
replace sediff = r(se) if n == 8
replace group = 1 if n == 8
replace treatment = 4 if n == 8

label define cats 1 "Tweet" 2 "Flag" 3 "Correction" 4 "Enhanced"
label define groups 3 "All" 2 "Democrats" 1 "Republicans"
label values group groups
label values treatment cats

replace l = diff-1.96*(sediff)
replace u = diff+1.96*(sediff)

gen x = _n
recode x  (8=1) (7=2) (6=3) (5=4) (4=5) (3=6) (2=7) (1=8)
replace x = . if x >8
replace x = x+2 if x >=3
replace x = x+2 if x >= 7
replace x = x+2 if x >= 11

separate diff, by(group)

twoway (dot  diff1 x, horizontal ndots(0) dcolor(white) symbol(triangle) color(black)) ///
(dot  diff2 x, horizontal ndots(0) dcolor(white) symbol(square) color(black)) ///
(rcap u l x, horizontal color(black)), yti("") graphregion(color(white)) ///
xlabel(-.2 "-20%" -.1 "-10%" 0 "0%" .1 "10%" .2 "20%") xline(0) ///
ylabel(1.5 "Enhanced" 5.5 "Correction" 9.5 "Flag" 13.5 "Tweet", angle(0)) /// 
ti("Support Executive Order" " ") ///
legend(order(2 "Democrats" 1 "Republicans") size(medsmall) keygap(0) cols(3)) saving(eoparty.gph, replace)

grc1leg2  mailparty.gph prevalenceparty.gph votemail2020party.gph eoparty.gph, graphregion(color(white)) iscale(.5)

* SUPPORTING INFORMATION *
use "D:\Dropbox\Trump twitter paper\ckk_PSQ_2020_replication.dta", clear

* SI Table 1 -- Sample Demographics *
sum black latino female 
tab education
sum age, detail
sum gop3 
sum dem3
tab ideology

* SI Table 2 -- Randomization Checks *
tabstat dem5, by(trump_category)
tabstat gop5, by(trump_category)
tabstat education, by(trump_category)
tabstat age, by(trump_category)
tabstat female, by(trump_category)
tabstat black, by(trump_category)
tabstat latino, by(trump_category)

oneway dem5 trump_category
oneway gop5 trump_category
oneway education trump_category
oneway age trump_category
oneway female trump_category
oneway black trump_category
oneway latino trump_category

* SI Table 3 *
logit mail_fraud_bin tweet flag correction enhanced dem5 gop5 female age education black latino
outreg2 using sitable3, word dec(2) label replace
ologit fraud tweet flag correction enhanced dem5 gop5 female age education black latino
outreg2 using sitable3, word dec(2) label append
test tweet=correction
logit mail_bin tweet flag correction enhanced dem5 gop5 female age education black latino
outreg2 using sitable3, word dec(2) label append
logit support_eo_bin tweet flag correction enhanced dem5 gop5 female age education black latino
outreg2 using sitable3, word dec(2) label append

* Additional test pooling two corrections treatments and performing Wald test * 
ologit fraud tweet any_correction dem5 gop5 female age education black latino
test tweet=any_correction

* SI Table 4 *
gen tweetxdem5 = tweet*dem5
gen tweetxgop5 = tweet*gop5
gen flagxdem5 = flag*dem5
gen flagxgop5 = flag*gop5
gen correctionxdem5 = correction*dem5
gen correctionxgop5 = correction*gop5
gen enhancedxdem5 = enhanced*dem5
gen enhancedxgop5 = enhanced*gop5
logit mail_fraud_bin tweet tweetxdem5 tweetxgop5 flag flagxdem5 flagxgop5 correction correctionxdem5 correctionxgop5  enhanced  enhancedxdem5  enhancedxgop5 dem5 gop5 female age education black latino 
outreg2 using sitable4, word dec(2) label replace
test tweetxdem5 = tweetxgop5
test flagxdem5=flagxgop5
test correctionxdem5 = correctionxgop5
test enhancedxdem5 = enhancedxgop5

ologit fraud tweet tweetxdem5 tweetxgop5 flag flagxdem5 flagxgop5 correction correctionxdem5 correctionxgop5  enhanced  enhancedxdem5  enhancedxgop5 dem5 gop5 female age education black latino 
outreg2 using sitable4, word dec(2) label append
test tweetxdem5 = tweetxgop5
test flagxdem5=flagxgop5
test correctionxdem5 = correctionxgop5
test enhancedxdem5 = enhancedxgop5

logit mail_bin tweet tweetxdem5 tweetxgop5 flag flagxdem5 flagxgop5 correction correctionxdem5 correctionxgop5  enhanced  enhancedxdem5  enhancedxgop5 dem5 gop5 female age education black latino 
outreg2 using sitable4, word dec(2) label append
test tweetxdem5 = tweetxgop5
test flagxdem5=flagxgop5
test correctionxdem5 = correctionxgop5
test enhancedxdem5 = enhancedxgop5

logit support_eo_bin tweet tweetxdem5 tweetxgop5 flag flagxdem5 flagxgop5 correction correctionxdem5 correctionxgop5  enhanced  enhancedxdem5  enhancedxgop5 dem5 gop5 female age education black latino 
outreg2 using sitable4, word dec(2) label append
test tweetxdem5 = tweetxgop5
test flagxdem5=flagxgop5
test correctionxdem5 = correctionxgop5
test enhancedxdem5 = enhancedxgop5

* SI FIGURE 1 -- Figure 2 but Excluding Leaners *
* Mail Fraud Occurs *
use trump_step.dta, replace

gen n = _n
gen diff = .
gen l = .
gen u = .
gen sediff = .
gen treatment = .
gen group = .

ttest mail_fraud_bin if control==1 & dem3 == 1|tweet==1 & dem3 == 1, by(tweet)
replace diff = r(mu_2)-r(mu_1) if n == 1
replace sediff = r(se) if n == 1
replace group = 2 if n == 1
replace treatment = 1 if n == 1

ttest mail_fraud_bin if control==1 & gop3 == 1 |tweet==1 & gop3 == 1, by(tweet)
replace diff = r(mu_2)-r(mu_1) if n == 2
replace sediff = r(se) if n == 2
replace group = 1 if n == 2
replace treatment = 1 if n == 2

ttest mail_fraud_bin if control==1 & dem3 == 1|flag==1 & dem3 == 1, by(flag)
replace diff = r(mu_2)-r(mu_1) if n == 3
replace sediff = r(se) if n == 3
replace group = 2 if n == 3
replace treatment = 2 if n == 3

ttest mail_fraud_bin if control==1 & gop3 == 1 |flag==1 & gop3 == 1, by(flag)
replace diff = r(mu_2)-r(mu_1) if n == 4
replace sediff = r(se) if n == 4
replace group = 1 if n == 4
replace treatment = 2 if n == 4

ttest mail_fraud_bin if control==1 & dem3 == 1|correction==1 & dem3 == 1, by(correction)
replace diff = r(mu_2)-r(mu_1) if n == 5
replace sediff = r(se) if n == 5
replace group = 2 if n == 5
replace treatment = 3 if n == 5

ttest mail_fraud_bin if control==1 & gop3 == 1 |correction==1 & gop3 == 1, by(correction)
replace diff = r(mu_2)-r(mu_1) if n == 6
replace sediff = r(se) if n == 6
replace group = 1 if n == 6
replace treatment = 3 if n == 6

ttest mail_fraud_bin if control==1 & dem3 == 1|enhanced==1 & dem3 == 1, by(enhanced)
replace diff = r(mu_2)-r(mu_1) if n == 7
replace sediff = r(se) if n == 7
replace group = 2 if n == 7
replace treatment = 4 if n == 7

ttest mail_fraud_bin if control==1 & gop3 == 1 |enhanced==1 & gop3 == 1, by(enhanced)
replace diff = r(mu_2)-r(mu_1) if n == 8
replace sediff = r(se) if n == 8
replace group = 1 if n == 8
replace treatment = 4 if n == 8

label define cats 1 "Tweet" 2 "Flag" 3 "Correction" 4 "Enhanced"
label define groups 3 "All" 2 "Democrats" 1 "Republicans"
label values group groups
label values treatment cats

replace l = diff-1.96*(sediff)
replace u = diff+1.96*(sediff)

gen x = _n
recode x  (8=1) (7=2) (6=3) (5=4) (4=5) (3=6) (2=7) (1=8)
replace x = . if x >8
replace x = x+2 if x >=3
replace x = x+2 if x >= 7
replace x = x+2 if x >= 11

separate diff, by(group)

twoway (dot  diff1 x, horizontal ndots(0) dcolor(white) symbol(triangle) color(black)) ///
(dot  diff2 x, horizontal ndots(0) dcolor(white) symbol(square) color(black)) ///
(rcap u l x, horizontal color(black)), yti("") graphregion(color(white)) ///
xlabel(-.2 "-20%" -.1 "-10%" 0 "0%" .1 "10%" .2 "20%") xline(0) ///
ylabel(1.5 "Enhanced" 5.5 "Correction" 9.5 "Flag" 13.5 "Tweet", angle(0)) /// 
ti("Mail Fraud Occurs" " ") ///
legend(order(2 "Democrats" 1 "Republicans") size(medsmall) keygap(0) cols(3)) saving(mailparty.gph, replace)


* Prevalence of Fraud *
use trump_step.dta, replace

gen n = _n
gen diff = .
gen l = .
gen u = .
gen sediff = .
gen treatment = .
gen group = .

ttest fraud if control==1 & dem3 == 1|tweet==1 & dem3 == 1, by(tweet)
replace diff = r(mu_2)-r(mu_1) if n == 1
replace sediff = r(se) if n == 1
replace group = 2 if n == 1
replace treatment = 1 if n == 1

ttest fraud if control==1 & gop3 == 1 |tweet==1 & gop3 == 1, by(tweet)
replace diff = r(mu_2)-r(mu_1) if n == 2
replace sediff = r(se) if n == 2
replace group = 1 if n == 2
replace treatment = 1 if n == 2

ttest fraud if control==1 & dem3 == 1|flag==1 & dem3 == 1, by(flag)
replace diff = r(mu_2)-r(mu_1) if n == 3
replace sediff = r(se) if n == 3
replace group = 2 if n == 3
replace treatment = 2 if n == 3

ttest fraud if control==1 & gop3 == 1 |flag==1 & gop3 == 1, by(flag)
replace diff = r(mu_2)-r(mu_1) if n == 4
replace sediff = r(se) if n == 4
replace group = 1 if n == 4
replace treatment = 2 if n == 4

ttest fraud if control==1 & dem3 == 1|correction==1 & dem3 == 1, by(correction)
replace diff = r(mu_2)-r(mu_1) if n == 5
replace sediff = r(se) if n == 5
replace group = 2 if n == 5
replace treatment = 3 if n == 5

ttest fraud if control==1 & gop3 == 1 |correction==1 & gop3 == 1, by(correction)
replace diff = r(mu_2)-r(mu_1) if n == 6
replace sediff = r(se) if n == 6
replace group = 1 if n == 6
replace treatment = 3 if n == 6

ttest fraud if control==1 & dem3 == 1|enhanced==1 & dem3 == 1, by(enhanced)
replace diff = r(mu_2)-r(mu_1) if n == 7
replace sediff = r(se) if n == 7
replace group = 2 if n == 7
replace treatment = 4 if n == 7

ttest fraud if control==1 & gop3 == 1 |enhanced==1 & gop3 == 1, by(enhanced)
replace diff = r(mu_2)-r(mu_1) if n == 8
replace sediff = r(se) if n == 8
replace group = 1 if n == 8
replace treatment = 4 if n == 8

label define cats 1 "Tweet" 2 "Flag" 3 "Correction" 4 "Enhanced"
label define groups 3 "All" 2 "Democrats" 1 "Republicans"
label values group groups
label values treatment cats

replace l = diff-1.96*(sediff)
replace u = diff+1.96*(sediff)

gen x = _n
recode x  (8=1) (7=2) (6=3) (5=4) (4=5) (3=6) (2=7) (1=8)
replace x = . if x >8
replace x = x+2 if x >=3
replace x = x+2 if x >= 7
replace x = x+2 if x >= 11

separate diff, by(group)

twoway (dot  diff1 x, horizontal ndots(0) dcolor(white) symbol(triangle) color(black)) ///
(dot  diff2 x, horizontal ndots(0) dcolor(white) symbol(square) color(black)) ///
(rcap u l x, horizontal color(black)), yti("") graphregion(color(white)) ///
xline(0) ///
ylabel(1.5 "Enhanced" 5.5 "Correction" 9.5 "Flag" 13.5 "Tweet", angle(0)) /// 
ti("Prevalence of Fraud" " ") ///
legend(order(2 "Democrats" 1 "Republicans") size(medsmall) keygap(0) cols(3)) saving(prevalenceparty.gph, replace)
*xlabel(-.2 "-20%" -.1 "-10%" 0 "0%" .1 "10%" .2 "20%") xline(0) ///


* Mail Voting in 2020 *
use trump_step.dta, replace

gen n = _n
gen diff = .
gen l = .
gen u = .
gen sediff = .
gen treatment = .
gen group = .

ttest mail_bin if control==1 & dem3 == 1|tweet==1 & dem3 == 1, by(tweet)
replace diff = r(mu_2)-r(mu_1) if n == 1
replace sediff = r(se) if n == 1
replace group = 2 if n == 1
replace treatment = 1 if n == 1

ttest mail_bin if control==1 & gop3 == 1 |tweet==1 & gop3 == 1, by(tweet)
replace diff = r(mu_2)-r(mu_1) if n == 2
replace sediff = r(se) if n == 2
replace group = 1 if n == 2
replace treatment = 1 if n == 2

ttest mail_bin if control==1 & dem3 == 1|flag==1 & dem3 == 1, by(flag)
replace diff = r(mu_2)-r(mu_1) if n == 3
replace sediff = r(se) if n == 3
replace group = 2 if n == 3
replace treatment = 2 if n == 3

ttest mail_bin if control==1 & gop3 == 1 |flag==1 & gop3 == 1, by(flag)
replace diff = r(mu_2)-r(mu_1) if n == 4
replace sediff = r(se) if n == 4
replace group = 1 if n == 4
replace treatment = 2 if n == 4

ttest mail_bin if control==1 & dem3 == 1|correction==1 & dem3 == 1, by(correction)
replace diff = r(mu_2)-r(mu_1) if n == 5
replace sediff = r(se) if n == 5
replace group = 2 if n == 5
replace treatment = 3 if n == 5

ttest mail_bin if control==1 & gop3 == 1 |correction==1 & gop3 == 1, by(correction)
replace diff = r(mu_2)-r(mu_1) if n == 6
replace sediff = r(se) if n == 6
replace group = 1 if n == 6
replace treatment = 3 if n == 6

ttest mail_bin if control==1 & dem3 == 1|enhanced==1 & dem3 == 1, by(enhanced)
replace diff = r(mu_2)-r(mu_1) if n == 7
replace sediff = r(se) if n == 7
replace group = 2 if n == 7
replace treatment = 4 if n == 7

ttest mail_bin if control==1 & gop3 == 1 |enhanced==1 & gop3 == 1, by(enhanced)
replace diff = r(mu_2)-r(mu_1) if n == 8
replace sediff = r(se) if n == 8
replace group = 1 if n == 8
replace treatment = 4 if n == 8

label define cats 1 "Tweet" 2 "Flag" 3 "Correction" 4 "Enhanced"
label define groups 3 "All" 2 "Democrats" 1 "Republicans"
label values group groups
label values treatment cats

replace l = diff-1.96*(sediff)
replace u = diff+1.96*(sediff)

gen x = _n
recode x  (8=1) (7=2) (6=3) (5=4) (4=5) (3=6) (2=7) (1=8)
replace x = . if x >8
replace x = x+2 if x >=3
replace x = x+2 if x >= 7
replace x = x+2 if x >= 11

separate diff, by(group)

twoway (dot  diff1 x, horizontal ndots(0) dcolor(white) symbol(triangle) color(black)) ///
(dot  diff2 x, horizontal ndots(0) dcolor(white) symbol(square) color(black)) ///
(rcap u l x, horizontal color(black)), yti("") graphregion(color(white)) ///
xlabel(-.2 "-20%" -.1 "-10%" 0 "0%" .1 "10%" .2 "20%") xline(0) ///
ylabel(1.5 "Enhanced" 5.5 "Correction" 9.5 "Flag" 13.5 "Tweet", angle(0)) /// 
ti("Support Voting by Mail in 2020" " ") ///
legend(order(2 "Democrats" 1 "Republicans") size(medsmall) keygap(0) cols(3)) saving(votemail2020party.gph, replace)

* Support EO *
use trump_step.dta, replace

gen n = _n
gen diff = .
gen l = .
gen u = .
gen sediff = .
gen treatment = .
gen group = .

ttest support_eo_bin if control==1 & dem3 == 1|tweet==1 & dem3 == 1, by(tweet)
replace diff = r(mu_2)-r(mu_1) if n == 1
replace sediff = r(se) if n == 1
replace group = 2 if n == 1
replace treatment = 1 if n == 1

ttest support_eo_bin if control==1 & gop3 == 1 |tweet==1 & gop3 == 1, by(tweet)
replace diff = r(mu_2)-r(mu_1) if n == 2
replace sediff = r(se) if n == 2
replace group = 1 if n == 2
replace treatment = 1 if n == 2

ttest support_eo_bin if control==1 & dem3 == 1|flag==1 & dem3 == 1, by(flag)
replace diff = r(mu_2)-r(mu_1) if n == 3
replace sediff = r(se) if n == 3
replace group = 2 if n == 3
replace treatment = 2 if n == 3

ttest support_eo_bin if control==1 & gop3 == 1 |flag==1 & gop3 == 1, by(flag)
replace diff = r(mu_2)-r(mu_1) if n == 4
replace sediff = r(se) if n == 4
replace group = 1 if n == 4
replace treatment = 2 if n == 4

ttest support_eo_bin if control==1 & dem3 == 1|correction==1 & dem3 == 1, by(correction)
replace diff = r(mu_2)-r(mu_1) if n == 5
replace sediff = r(se) if n == 5
replace group = 2 if n == 5
replace treatment = 3 if n == 5

ttest support_eo_bin if control==1 & gop3 == 1 |correction==1 & gop3 == 1, by(correction)
replace diff = r(mu_2)-r(mu_1) if n == 6
replace sediff = r(se) if n == 6
replace group = 1 if n == 6
replace treatment = 3 if n == 6

ttest support_eo_bin if control==1 & dem3 == 1|enhanced==1 & dem3 == 1, by(enhanced)
replace diff = r(mu_2)-r(mu_1) if n == 7
replace sediff = r(se) if n == 7
replace group = 2 if n == 7
replace treatment = 4 if n == 7

ttest support_eo_bin if control==1 & gop3 == 1 |enhanced==1 & gop3 == 1, by(enhanced)
replace diff = r(mu_2)-r(mu_1) if n == 8
replace sediff = r(se) if n == 8
replace group = 1 if n == 8
replace treatment = 4 if n == 8

label define cats 1 "Tweet" 2 "Flag" 3 "Correction" 4 "Enhanced"
label define groups 3 "All" 2 "Democrats" 1 "Republicans"
label values group groups
label values treatment cats

replace l = diff-1.96*(sediff)
replace u = diff+1.96*(sediff)

gen x = _n
recode x  (8=1) (7=2) (6=3) (5=4) (4=5) (3=6) (2=7) (1=8)
replace x = . if x >8
replace x = x+2 if x >=3
replace x = x+2 if x >= 7
replace x = x+2 if x >= 11

separate diff, by(group)

twoway (dot  diff1 x, horizontal ndots(0) dcolor(white) symbol(triangle) color(black)) ///
(dot  diff2 x, horizontal ndots(0) dcolor(white) symbol(square) color(black)) ///
(rcap u l x, horizontal color(black)), yti("") graphregion(color(white)) ///
xlabel(-.2 "-20%" -.1 "-10%" 0 "0%" .1 "10%" .2 "20%") xline(0) ///
ylabel(1.5 "Enhanced" 5.5 "Correction" 9.5 "Flag" 13.5 "Tweet", angle(0)) /// 
ti("Support Executive Order" " ") ///
legend(order(2 "Democrats" 1 "Republicans") size(medsmall) keygap(0) cols(3)) saving(eoparty.gph, replace)

grc1leg2  mailparty.gph prevalenceparty.gph votemail2020party.gph eoparty.gph, graphregion(color(white)) iscale(.5)
